﻿using System;
using System.Xml.Linq;
using System.Collections.Generic;
using HigLabo.Net.Extensions;


namespace HigLabo.Net.Twitter
{
    /// <summary>
    /// 
    /// </summary>
    public class RateLimits : ResponseObject
    {
        /// <summary>
        /// 
        /// </summary>
        public RateLimitContext RateLimitContext { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Help { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Statuses { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Users { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Search { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Lists { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Application { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection FriendShips { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Blocks { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Geo { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Followers { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Friends { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection DirectMessages { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Account { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Favorites { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection SavedSearches { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public RateLimitInfoCollection Trends { set; get; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public RateLimits(String jsonText)
        {
            this.SetProperty(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public override void SetProperty(string jsonText)
        {
            var d = this.SetData(jsonText);
            this.RateLimitContext = new RateLimitContext(d.ToString("rate_limit_context"));

            d = this.SetData(d.ToString("resources"));
            this.Help = new RateLimitInfoCollection(d.ToString("help"));
            this.Statuses = new RateLimitInfoCollection(d.ToString("statuses"));
            this.Users = new RateLimitInfoCollection(d.ToString("users"));
            this.Search = new RateLimitInfoCollection(d.ToString("search"));
            this.Lists = new RateLimitInfoCollection(d.ToString("lists"));
            this.Application = new RateLimitInfoCollection(d.ToString("application"));
            this.FriendShips = new RateLimitInfoCollection(d.ToString("friendships"));
            this.Blocks = new RateLimitInfoCollection(d.ToString("blocks"));
            this.Geo = new RateLimitInfoCollection(d.ToString("geo"));
            this.Followers = new RateLimitInfoCollection(d.ToString("followers"));
            this.Friends = new RateLimitInfoCollection(d.ToString("friends"));
            this.DirectMessages = new RateLimitInfoCollection(d.ToString("direct_messages"));
            this.Account = new RateLimitInfoCollection(d.ToString("account"));
            this.Favorites = new RateLimitInfoCollection(d.ToString("favorites"));
            this.SavedSearches = new RateLimitInfoCollection(d.ToString("saved_searches"));
            this.Trends = new RateLimitInfoCollection(d.ToString("trends"));
        }
    }
}
